Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Commit 5870af2db9f785348612424c09fa103ca2d1347e


Parents : 026b8c5
Author : Ivan <e46112d44649266d71fe2193e00a4710>
Signature : T66BB85Valid, signed by author
Date : 2026-07-23T12:34:56-05:00

fix: type safety in LXST profiles compatibility functions by using type casting for callable native methods

Changes

2 files changed, 7 insertions(+), 3 deletions(-)


Diff

diff --git a/meshchatx.rsm b/meshchatx.rsm
index 012be9e8..495bdf4a 100644
Binary files a/meshchatx.rsm and b/meshchatx.rsm differ

diff --git a/meshchatx/src/backend/lxst_profiles_compat.py b/meshchatx/src/backend/lxst_profiles_compat.py
index e36545ec..c9aecd32 100644
--- a/meshchatx/src/backend/lxst_profiles_compat.py
+++ b/meshchatx/src/backend/lxst_profiles_compat.py
@@ -10,6 +10,9 @@ crashes when an older Profiles class is present.
from __future__ import annotations
+from collections.abc import Callable
+from typing import Any, cast
+
# Match LXST 0.5+ Profiles constants when the installed package lacks them.
MODE_FULL_DUPLEX = 0x01
MODE_HALF_DUPLEX = 0x02
@@ -58,7 +61,8 @@ def available_modes(profiles=None) -> list[int]:
Profiles = profiles if profiles is not None else import_profiles()
native = getattr(Profiles, "available_modes", None)
if callable(native):
- return list(native())
+ modes = cast(Callable[[], Any], native)()
+ return [int(mode_id) for mode_id in modes]
# Pre-duplex LXST: full duplex only. Half duplex needs switch_mode / squelch.
return [mode_full_duplex(Profiles)]
@@ -67,7 +71,7 @@ def mode_name(mode_id, profiles=None) -> str:
Profiles = profiles if profiles is not None else import_profiles()
native = getattr(Profiles, "mode_name", None)
if callable(native):
- return str(native(mode_id))
+ return str(cast(Callable[[Any], Any], native)(mode_id))
return _MODE_NAMES.get(int(mode_id), "Default")
@@ -75,5 +79,5 @@ def mode_abbreviation(mode_id, profiles=None) -> str:
Profiles = profiles if profiles is not None else import_profiles()
native = getattr(Profiles, "mode_abbrevation", None)
if callable(native):
- return str(native(mode_id))
+ return str(cast(Callable[[Any], Any], native)(mode_id))
return _MODE_ABBREVS.get(int(mode_id), "DFLT")


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────